package day3.fight;

import java.util.Scanner;
//经验：子类和父类冲突的时候采用super，要不然子类是可以直接调用的父类的public方法，用instanceof判断多态具体类型，先goldcard，传参的时候再用多态
//在类中，任何方法的位置没有讲究只看权限，权限是public不管上下都可以访问调用，
//@Date便捷使用get set，tostring方法，不用自己写了，noar.....无参，all......有参
public class test {
    public static void main(String []args)
    {
     goldcard c1=new goldcard("豫a123","小王","135",10000);
     silvercard c2=new silvercard("豫a124","小王wang","1356",1500);
        c1.remain(100);//存钱
        c2.remain(100);//存钱

     /*
     card c1=new goldcard("豫a123","小王","135",10000);
     card c2=new silvercard("豫a123","小王","135",1500);
     */
        pay(c2);
    }

public static void pay(card c)
{
    System.out.println("请刷卡,输入您消费的金额");

    Scanner sc=new Scanner(System.in);
    double money=sc.nextDouble();

    if(c instanceof goldcard)
    {
        System.out.println("尊贵的金卡用户你好");
        c.consume(money);
    }
    else
    {
        System.out.println("尊贵的银卡用户你好");
        c.consume(money);
    }
}

}
